/*
 * Copyright (c) 2024 Black Sesame Technologies
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _DAL_CYCLONEDDS_STATUS_CONVERTER_HPP_
#define _DAL_CYCLONEDDS_STATUS_CONVERTER_HPP_

#include "dds/dds.h"
#include "dal/status.h"
#include "dal/ret_type.h"

class StatusConverter
{
protected:
    StatusConverter();
    static StatusConverter* singleton_;

public:
    StatusConverter(StatusConverter& other) = delete;
    void operator=(const StatusConverter&) = delete;
    static StatusConverter* GetInstance();

    dal_ret_t
    ConvertInconsistentTopicStatusFromCycloneddsToDal(const dds_inconsistent_topic_status_t* c_status,
                                                   dal_inconsistent_topic_status_t* d_status);

    dal_ret_t ConvertSampleLostStatusFromCycloneddsToDal(const dds_sample_lost_status_t* c_status,
                                                      dal_sample_lost_status_t* d_status);

    dal_ret_t ConvertSampleRejectedStatusFromCycloneddsToDal(const dds_sample_rejected_status_t* c_status,
                                                          dal_sample_rejected_status_t* d_status);

    dal_ret_t ConvertLivelinessLostStatusFromCycloneddsToDal(const dds_liveliness_lost_status_t* c_status,
                                                          dal_liveliness_lost_status_t* d_status);

    dal_ret_t
    ConvertLivelinessChangedStatusFromCycloneddsToDal(const dds_liveliness_changed_status_t* c_status,
                                                   dal_liveliness_changed_status_t* d_status);

    dal_ret_t ConvertOfferedDeadlineMissedStatusFromCycloneddsToDal(
        const dds_offered_deadline_missed_status_t* c_status, dal_offered_deadline_missed_status_t* d_status);

    dal_ret_t ConvertRequestedDeadlineMissedStatusFromCycloneddsToDal(
        const dds_requested_deadline_missed_status_t* c_status,
        dal_requested_deadline_missed_status_t* d_status);

    dal_ret_t ConvertOfferedIncompatibleQosStatusFromCycloneddsToDal(
        const dds_offered_incompatible_qos_status_t* c_status,
        dal_offered_incompatible_qos_status_t* d_status);

    dal_ret_t ConvertRequestedIncompatibleQosStatusFromCycloneddsToDal(
        const dds_requested_incompatible_qos_status_t* c_status,
        dal_requested_incompatible_qos_status_t* d_status);

    dal_ret_t
    ConvertPublicationMatchedStatusFromCycloneddsToDal(const dds_publication_matched_status_t* c_status,
                                                    dal_publication_matched_status_t* d_status);

    dal_ret_t
    ConvertSubscriptionMatchedStatusFromCycloneddsToDal(const dds_subscription_matched_status_t* c_status,
                                                     dal_subscription_matched_status_t* d_status);
};

#endif  // _DAL_CYCLONEDDS_STATUS_CONVERTER_HPP_
